
package swb.api.com.vo;

import lombok.Data;

/**
 * 通用返回结果类
 */
@Data
public class Result<T> {
    private Integer code;
    private String msg;
    private T data;

    public static <T> Result<T> success(T data, String msg) {
        Result<T> result = new Result<>();
        result.code = 200;
        result.data = data;
        result.msg = msg;
        return result;
    }

    public static <T> Result<T> error(String msg) {
        Result<T> result = new Result<>();
        result.code = 500;
        result.msg = msg;
        return result;
    }
}